import { getToken } from "@/utils/utils"
import { Navigate } from "react-router-dom"

export function AuthRouter({children}: { children: React.ReactElement }) {
  const token = getToken()
  if(token) {
    return <>{children}</>
  } else {
    return <Navigate to={'/login'} replace></Navigate>
  }
}